<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>备忘录</title>
    <script src="vue.js"></script>
</head>
<body>
    <div id="abc">
        <div>task:{{task}}</div>
        <input v-model="task" type="text" placeholder="请输入新任务">
        <button @click="add()">创建</button>
        <button>清空</button>
        <ul>
            <li v-for="(item, index) in items" :key="index">{{item}} <button>X</button></li>
            
        </ul>
    </div>
</body>
<script>
    new Vue({
        el:'#abc',
        data() {
            return {
                task:'',
                items:["唱","跳","rap","篮球"],
            }
        },
        methods: {
            add:function(){
                this.items.push(this.task);
                this.task="";
            }
        },
    })
</script>
</html>